<script setup>
import { ref, warn } from 'vue';
// defineProps接收父组件的值
const props = defineProps(['username', 'avator']);
console.log(props.username);
console.log(props.avator);
const avatar = ref('https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/unicloudlogo.png');

const delivery = ref({
    type: 'success', // success error
    text: '本店全天免费配送'
});
</script>

<template>
    <view class="category-item">
        <!-- <navigator hover-class="none" url="/pages/shop/shopdetail" open-type="reLaunch"> -->
        <navigator hover-class="navigator-hover" url="/pages/shop/shopdetail">
            <view class="c-header">
                <image class="icon" src="@/static/temp/ad_duck_shop.jpeg"></image>
                <view class="c-title">
                    <text class="title">京味张烤鸭店</text>
                    <text class="card-actions-item-text">已售15单</text>
                    <br />
                    <text class="card-actions-item-text">起送价18元</text>
                    <uni-tag :inverted="true" text="满25减3" type="warning" />
                </view>
                <view class="localtion">
                    <text class="card-right-location">1.5km</text>
                    <uni-tag text="免费配送" type="warning" style="margin-right: 10rpx" />
                </view>
            </view>
            <view class="delivery">
                <uni-tag :type="delivery.type" :circle="true" size="mini" :text="delivery.text" style="padding: 0 5rpx 0 5rpx" />
            </view>
            <view class="item-picture">
                <view class="hot-good" v-for="(item, index) in 3">
                    <image class="hot-img" src="@/static/temp/duck.jpeg" mode="aspectFill"></image>
                    <text class="product-name">三拼盖浇饭【配啤酒】畅饮】</text>
                    <view class="price-box">
                        <text class="discounted-price">¥15.80</text>
                        <text class="original-price">¥20.8</text>
                    </view>
                </view>
            </view>
        </navigator>
    </view>
</template>
<style lang="scss" scoped>
.category-item {
    width: 730rpx;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: left;
    margin: 10rpx;
    padding-bottom: 10rpx;
    box-sizing: border-box;
    background-color: $uni-bg-color;
    border-radius: 10rpx;
}
.navigator-hover {
    background-color: rgba(0, 0, 0, 0.1);
    opacity: 0.7;
}
.c-header {
    display: flex;
    flex-direction: row;
    justify-content: left;
    align-items: center;
    margin: 10rpx 10rpx 0 10rpx;
    .icon {
        width: 150rpx;
        height: 150rpx;
    }
    .c-title {
        align-self: flex-start;
        margin: 0 2rpx 10rpx;
        display: flex;
        align-items: baseline;
        flex-direction: column;
        justify-content: flex-start;
        flex: 1;
        // background-color: rgba($color: #000000, $alpha: 0.4);
    }
    .card-actions-item-text {
        font-size: 14px;
        color: #666;
        margin-left: 5px;
    }
    .card-right-location {
        display: flex;
        align-items: flex-end;
        color: #666;
        margin-bottom: 10rpx;
    }
}
.localtion {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.delivery {
    display: flex;
    justify-content: center;
    margin-bottom: 10rpx;
}
.item-picture {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    .hot-good {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .hot-img {
        width: 180rpx;
        height: 180rpx;
    }
}
.product-name {
    width: 150rpx;
    font-size: 15rpx;
    margin-top: 5rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: black;
    font-weight: bold;
}
.price-box {
    padding-left: 20rpx;
    padding-right: 20rpx;
    display: flex;
    flex-direction: row;
    justify-content: left;
    align-items: center;
    width: 140rpx;
}
.discounted-price {
    font-size: $list-font-base;
    margin-top: 5rpx;
    color: orange;
    font-weight: bold;
    justify-content: left;
}
.original-price {
    font-size: $list-font-sm;
    text-decoration: line-through;
    color: $font-color-light;
    margin-left: 8rpx;
}
</style>
